import http from './interface'
import store from '@/store/index.js'
import RongIMLib from '@/static/js/IMSDK/RongIMLib-3.0.7-dev.js'
const im = RongIMLib.init({ appkey: 'qf3d5gbjq9qxh' });
import axios from 'axios'
//设置baseUrl
// http.config.baseUrl = "http://192.168.0.122:18083/health"
// http.config.baseUrl = "http://192.168.0.182:18083/health/"
http.config.baseUrl = "http://192.168.0.115:18083/health"
// http.config.baseUrl = "http://192.168.0.183:18083/health/"
//设置请求前拦截器
http.interceptor.request = (config) => {
	uni.showLoading({title:'加载中...'})
	//添加通用参数
	config.url.indexOf('uploadImg') > 1 ? 
		config.header = {
		    "Access-Token": localStorage.token,
			"Content-Type":"application/x-www-form-urlencoded"
		}
	:
		config.header = {
		    "Access-Token": localStorage.token
		}
}
//设置请求结束后拦截器
http.interceptor.response = (response) => {
	uni.hideLoading()
	const returnCode = typeof(response.data) != 'object' ? JSON.parse(response.data).returnCode : response.data.returnCode
    //判断返回状态 执行相应操作
	if(!returnCode){
		uni.showToast({title: response.data.Result?response.data.Result:'系统异常',icon:'none'});
	}else if(returnCode == 1000){
		// uni.showToast({title: response.data.message?response.data.message:'登录超时',icon:'none',duration:1500});
		setTimeout(()=>{
			localStorage.removeItem('userInfo')
			im.disconnect().then(function() {
				console.log('断开链接成功');
			});
			toLogin()
		},1000)
	}
    return response;
}

	if (!localStorage.userInfo) {
		uni.navigateTo({
			url: '/pages/login/index'
		})
	}

// 登录
export const login = (data) => { return http.request({ url: '/Account/login', method: 'post',  data,})}
// 退出
export const logout = (data) => {return http.request({url: '/Account/logout',method: 'post', data,})}
// 关注我的 （我的会员）
export const attentionList = (data) => {return http.request({url: '/User/list',method: 'get',data})}
//会员列表
export const selectMembershipList = (data) => {return http.request({url: '/User/member?pageIndex=1&pageSize=20',method: 'get',data})}
// 回关用户
export const addUser = (data) => {return http.request({url: '/User/addUser',method: 'post',data})}
//取消关注用户
export const cancelUser = (uhId) => {return http.request({url: `/User/cancelUser/${uhId}`,method: 'post'})}
//取消用户回关
export const BdMember = (data) => {return http.request({url: `/User/BdMember`,method: 'get',data})}
// 修改密码
export const updatePassword = (password) => {return http.request({url: '/Account/updatePassword?password='+password,method: 'post'})}
// 健康管理师信息
export const findByHealthId = (data) => {return http.request({url: '/HealthDetailes/findByHealthId',method: 'get',})}
//通讯录
export const addressList = (data) => {return http.request({url: '/HealthDetailes/addressList',method: 'get', data})}
//多图上传
export const multipleFiles = (data) => {return http.request({url: '/File/multipleFiles',method: 'post', data})}
// 编辑健康管理师
export const updateHealth = (data) => {return http.request({url: '/HealthDetailes/updateHealth',method: 'post', data})}
// 会员列表
export const userMember = (data) => {return http.request({url: '/User/member',method: 'GET', data})}
// 新增会员记录
export const Memberrecord = (pageIndex,pageSize) => {return http.request({url: `/Member/record?pageIndex=${pageIndex}&pageSize=${pageSize}`,method: 'post'})}
// 查会员信息
export const findByUser = (userId) => {return http.request({url: `/Member/findByUser/${userId}`,method: 'get'})}
// 新增会员基本信息
export const userInfoAdd = (data) => {return http.request({url: '/UserInfo/add',method: 'post', data})}
// 用户个人基本信息详情
export const findByUserId = (id) => {return http.request({url: `/UserInfo/findById/${id}`,method: 'get'})}
export const findByUserInfo = (id) => {return http.request({url: `/UserInfo/info/${id}`,method: 'get'})}
// 会员基本信息列表
export const userInfolist = (data) => {return http.request({url: '/UserInfo/list',method: 'get', data})}
// 查看会员基本信息详情
export const UserInfofindById = (id) => {return http.request({url: `/UserInfo/findById/${id}`,method: 'get'})}
// 查询中医体质辨识是否有未签发的问卷
export const findByStatusTcm = (userId) => {return http.request({url: '/appchinesemedicineexamination/findByStatus?userId='+userId,method: 'get'})}
export const findByStatusUserInfo = (userId) => {return http.request({url: '/UserInfo/findByStatus?userId='+userId,method: 'get'})}
export const findByStatusFindByStatus = (userId) => {return http.request({url: '/InterventionPlan/findByStatus?userId='+userId,method: 'get'})}

//查看中医体质问卷详情单条
export const findByConstitutionId = (id) => {return http.request({url: `/appchinesemedicineexamination/findByConstitution/${id}`,method: 'get'})}


//上传图片
export const uploadImg = (formData) => {
	return new Promise((resolve, reject) => {
		uni.uploadFile({
			url: http.config.baseUrl + '/File/uploadImg',
			formData,
			header: {
				'Access-Token':localStorage.token,
			},
			success: function(res) {
				resolve(JSON.parse(res.data));
			},
			fail: function(res) {
				reject(JSON.parse(res.data))
			},
		})
	});
}
// 删除图片
export const delUrl = (url) => {return http.request({url: '/File/delUrl?url='+url,method: 'post'})}
// 获取用户转化分
export const toBbtainTCM= (id,data) => {return http.request({url: `/AppConstitutionQuestionnaire/info/${id}`,method: 'GET',data})}
// 修正转化分
export const AppConstitutionQuestionnaireUpdate= (data) => {return http.request({url: `/AppConstitutionQuestionnaire/update`,method: 'post',data})}
// 获取最新得用户转化分
export const newScore= (data) => {return http.request({url: '/appchinesemedicineexamination/physiqueScoreList',method: 'GET',data})}
// 创建中医体检
export const appchinesemedicineexaminationSave = (data,type) => {return http.request({url: `/appchinesemedicineexamination/save?type=`+type , method: 'post',data})}
// 编辑中医体检
export const appchinesemedicineexaminationUpdate = (data) => {return http.request({url: `/appchinesemedicineexamination/update`,method: 'post',data})}
// 中医体检列表
export const appchinesemedicineexaminationList = (data) => {return http.request({url: `/appchinesemedicineexamination/list`,method: 'get',data})}
// 中医体检详情
export const appchinesemedicineexaminationInfo = (id,data) => {return http.request({url: `/appchinesemedicineexamination/info/${id}`,method: 'get',data})}
// 中医体检列表
export const tcmList = (data) => {return http.request({url: '/appchinesemedicineexamination/list',method: 'get',data})}
// 保存用户的问卷
export const memberIdList = (data) => {return http.request({url: '/AppConstitutionQuestionnaire/save',method: 'POST',data})}
// 删除中医体检
export const delTcmList = (id) => {return http.request({url: `/appchinesemedicineexamination/delete/${id}`,method: 'POST'})}

// 干预方案列表
export const interveneSchemeList = (data) => {return http.request({url: '/health/InterveneScheme/list',method: 'get', data})}

// 新增会员
export const addPersonnel = (data) => {return http.request({url: '/Member/addPersonnel',method: 'POST',data})}

// 验证手机号
export const verifyMobile = (data) => {return http.request({url: '/Member/verifyMobile?phone='+data,method: 'POST'})}

// 删除个人基本信息
export const UserInfodelete = (id) => {return http.request({url:`/UserInfo/delete/${id}`,method: 'post'})}

//创建干预方案
export const InterveneSchemeSave = (data) => {return http.request({url: '/health/InterveneScheme/save',method: 'POST',data})}

//干预方案详情
export const InterveneSchemeInfo = (id,userId) => {return http.request({url: `/health/InterveneScheme/info/${id}/${userId}`,method: 'get'})}

//干预方案修改
export const InterveneSchemeupdate = (id,data) => {return http.request({url: `/health/InterveneScheme/update/${id}`,method: 'post',data})}

//干预方案删除
export const InterveneSchemedelete = (id) => {return http.request({url: `/health/InterveneScheme/delete/${id}`,method: 'post'})}


// 修改个人基本信息
export const userinforUpdate = (data) => {return http.request({url: '/UserInfo/update',method: 'POST',data})}

// 健康专家列表
export const speciaList = (data) => {return http.request({url: '/Expert/expertList',method: 'get',data})}

// 绑定健康专家
export const bdExpert = (data) => {return http.request({url: '/Expert/BdExpert',method: 'post',data})}

// 创建干预计划
export const InterventionPlanSave = (data) => {return http.request({url: '/InterventionPlan/save',method: 'post',data})}

// 干预方案列表
export const InterventionPlanPlanList = (data) => {return http.request({url: '/InterventionPlan/planList',method: 'get',data})}


// 干预计划
export const InterventionPlanList = (data) => {return http.request({url: '/InterventionPlan/list',method: 'get',data})}

// 干预方案详情
export const InterventionPlanDetails = (id) => {return http.request({url: `/InterventionPlan/details/${id}`,method: 'get'})}

// 干预方案详情
export const InterventionPlanUpdate = (data) => {return http.request({url: `/InterventionPlan/update`,method: 'post',data})}

// 删除干预方案
export const InterventiondeleteByPlan= (id) => {return http.request({url: `/InterventionPlan/deleteByPlan/${id}`,method: 'post'})}

// 删除干预计划
export const Interventiondelete = (id) => {return http.request({url: `/InterventionPlan/delete/${id}`,method: 'post'})}


// 执行干预计划
export const InterventionrunPlan = (id) => {return http.request({url: `/InterventionPlan/runPlan?id=${id}`,method: 'post'})}

//IM获取token
export const IMgetUserToken = (data) => { return http.request({url: '/sms/getUserToken',method: 'get',data}) }

//创建群聊
export const createGroup = (data) => { return http.request({url: '/sms/createGroup',method: 'post',data}) }

//获取群组成员
export const groupMembers = (data) => {return http.request({url: `/sms/groupMembers`,method: 'get',data})}

//通讯录
export const getMailList = (data) => {return http.request({url: '/HealthDetailes/addressList',method: 'get',data})}

//添加用户进群组
export const inviteUser = (groupId,data) => {return http.request({url: `/sms/inviteUser/${groupId}`,method: 'post',data})}

//群组-删除用户
export const userQuit = (groupId,data) => {return http.request({url: `/sms/userQuit/${groupId}`,method: 'post',data})}


// 确认分数
export const AppConstitutionQuestionnaireScoreSure= (data) => {return http.request({url: `/AppConstitutionQuestionnaire/upDateSigDate`,method: 'post',data})}

//解散群组
export const dissolution = (groupId,data) => {return http.request({url: `/sms/dissolution/${groupId}`,method: 'post',data})}

//解散群组
export const appchinesemedicineexaminationfindById = (id) => {return http.request({url: `/appchinesemedicineexamination/findById/${id}`,method: 'get'})}

//获取系统配置项列表和单个数据
export const DataDictfindByType = (data) => {return http.request({url: `/DataDict/findByType`,method: 'get',data})}

// 获取问卷模版
export const getQuestionnaireStencil = (data) => {return http.request({url: '/Questionnaire/getQuestionnaireStencil',method: 'get',data})}

// 问卷详情
export const Questionnairefind = (userId,id,data) => {return http.request({url: `/Questionnaire/find/${userId}/${id}`,method: 'get',data})}

// 健康管理师新增问卷答案
export const uploadQuestionnaire = (userId,data) => {return http.request({url: `/Questionnaire/uploadQuestionnaire/${userId}`,method: 'post',data})}

// 问卷列表
export const Questionnairelist = (data) => {return http.request({url: `/Questionnaire/list`,method: 'get',data})}

// 健康管理师编辑问卷答案
export const updateAppQuestionnaire = (id,userId,data) => {return http.request({url: `/Questionnaire/updateAppQuestionnaire/${id}/${userId}`,method: 'post',data})}

// 删除问卷
export const QuestionnaireDel = (id) => {return http.request({url: `/Questionnaire/del/${id}`,method: 'post'})}

// 获取体检报告模版
export const getReportTemplateStencil = () => {return http.request({url: '/Assess/getReportTemplateStencil',method: 'get'})}

//健康管理师添加体检报告
export const healthMedicalsave = (data) => {return http.request({url: `/Medical/healthMedical`,method: 'POST',data})}

// 添加体检报告
export const Medicalinsert = (data) => {return http.request({url: `/Medical/insert`,method: 'POST',data})}

// 获取体检报告列表
export const MedicalList = (data) => {return http.request({url: '/Medical/list',method: 'get',data})}

// 获取体检报告详情
export const MedicalfindbyId = (id) => {return http.request({url: `/Medical/findBy/${id}`,method: 'get'})}


// 编辑体检报告
export const Medicalupdate = (data) => {return http.request({url: `/Medical/update`,method: 'POST',data})}

// 删除体检报告
export const Medicaldel = (id) => {return http.request({url: `/Medical/del/${id}`,method: 'POST'})}

// 给用户添加体检报告
export const reportAddReport = (data) => {return http.request({url: `/report/addReport`,method: 'POST',data})}


// 健康师添加体检报告
export const healthAddReport = (data) => {return http.request({url: `/report/healthAddReport`,method: 'POST',data})}

//查询体检报告--或体检报告详情
export const findByMedical = (userId,reportNumber) => {return http.request({url: `/report/findBy/${reportNumber}/${userId}`,method: 'get'})}

// 健康师添加体检报告
export const reportupdate = (id,data) => {return http.request({url: `/report/update/${id}`,method: 'POST',data})}

// 获取所有异常列表
export const getReportAbnormalPage = (data) => {return http.request({url: `/Assess/getReportAbnormalPage`,method: 'get',data})}

// 获取所有体检项目列表
export const getReportTemplateStencilPage = (data) => {return http.request({url: `/Assess/getReportTemplateStencilPage`,method: 'get',data})}
//风险评估总结
export const HealthRisksSave= (data) => {return http.request({url: `/HealthRisks/save`,method: 'post',data})}
//风险评估总结列表
export const HealthRiskslist = (data) => {return http.request({url: `/HealthRisks/list`,method: 'get',data})}
//风险评估总结列表删除
export const HealthRisksdel = (id) => {return http.request({url: `/HealthRisks/delete/${id}`,method: 'post'})}
//风险评估总结查看详情
export const HealthRisksInfo = (id) => {return http.request({url: `/HealthRisks/info/${id}`,method: 'get'})}
//风险评估总结编辑
export const HealthRisksUpdata= (data) => {return http.request({url: `/HealthRisks/update`,method: 'post',data})}
//删除体检报告
export const reportdel = (id) => {return http.request({url: `/report/del/${id}`,method: 'post'})}
//健康师删除用户体检报告
export const delReportNo = (userId,reportNo) => {return http.request({url: `/Assess/del/${userId}/${reportNo}`,method: 'post'})}
//健康师给指定用户添加的评估报告状态
export const Assessreport = (userId) => {return http.request({url: `/Assess/report/${userId}`,method: 'get'})}
//会员申请评估列表
export const Assesslist = (data) => {return http.request({url: `/Assess/list`,method: 'get',data})}
// 查询体检报告
export const AssessfindById = (id,data) => {return http.request({url: `/Assess/findById/${id}`,method: 'get',data})}
// 生成报告
export const AssesscreateReport = (data) => {return http.request({url: `/Assess/createReport`,method: 'get',data})}
// 上传用户问卷答案
export const addQuestionnaireByUser = (data) => {return http.request({url: `/Assess/addQuestionnaireByUser`,method: 'post',data})}
// 健康管理师上传用户体检报告至希和
export const uploadUserAssessReport = (data) => {return http.request({url: `/Assess/uploadUserAssessReport`,method: 'post',data})}
// 上传健康师指定用户添加的体检报告
export const uploadHealthAddUserReport = (data) => {return http.request({url: `/Assess/uploadHealthAddUserReport`,method: 'post',data})}
//随访记录  新增
export const AppFollowUpRecordsSave = (data) => {return http.request({url: `/AppFollowUpRecords/save`,method: 'post',data})}
//随访记录  修改
export const AppFollowUpRecordsUpdate = (data) => {return http.request({url: `/AppFollowUpRecords/update`,method: 'post',data})}
//随访记录  列表
export const AppFollowUpRecordsList = (data) => {return http.request({url: `/AppFollowUpRecords/list`,method: 'get',data})}
//随访记录  详情
export const AppFollowUpRecordsDetaile = (id) => {return http.request({url: `/AppFollowUpRecords/detaile/${id}`,method: 'get'})}
//随访记录  删除
export const AppFollowUpRecordsDelete = (id) => {return http.request({url: `/AppFollowUpRecords/delete/${id}`,method: 'post'})}
//新增发送通知
export const messageNoticeSave = (data) => {return http.request({url: `/messageNotice/save`,method: 'post',data})}
//发送通知列表
export const messageNoticelist = (data) => {return http.request({url: `/messageNotice/list`,method: 'get',data})}
//发送通知详情
export const messageNoticeInfo = (id) => {return http.request({url: `/messageNotice/info/${id}`,method: 'get'})}
//编辑发送通知
export const messageNoticeUpdate= (data) => {return http.request({url: `/messageNotice/update`,method: 'post',data})}
//删除发送通知
export const messageNoticeDelete = (id) => {return http.request({url: `/messageNotice/delete?id=${id}`,method: 'post'})}


//转诊记录  新增
export const AppHealthReferralRecordsSave = (data) => {return http.request({url: `/AppHealthReferralRecords/save`,method: 'post',data})}
//转诊记录  列表
export const AppHealthReferralRecordsList = (data) => {return http.request({url: `/AppHealthReferralRecords/list`,method: 'get',data})}
//转诊记录  详情
export const AppHealthReferralRecordsInfo = (id) => {return http.request({url: `/AppHealthReferralRecords/info/${id}`,method: 'get'})}
//转诊记录  修改
export const AppHealthReferralRecordsUpdate = (data) => {return http.request({url: `/AppHealthReferralRecords/update`,method: 'post',data})}
//转诊记录  删除
export const AppHealthReferralRecordsDelete = (id) => {return http.request({url: `/AppHealthReferralRecords/delete/${id}`,method: 'post'})}
//科普文章列表
export const Articlelist = (data) => {return http.request({url: `/Article/list`,method: 'get',data})}
//科普文章 新增
export const ArticleSave = (data) => {return http.request({url: `/Article/save`,method: 'post',data})}
//科普文章  详情
export const ArticleInfo = (id) => {return http.request({url: `/Article/info/${id}`,method: 'get'})}
//科普文章   删除
export const ArticleDelete = (id) => {return http.request({url: `/Article/delete/${id}`,method: 'post'})}
//科普文章   编辑
export const ArticleUpdate = (id,data) => {return http.request({url: `/Article/update/${id}`,method: 'post',data})}
//科普文章类型接口
export const ArticleTypelist = () => {return http.request({url: `/AdArticlelType/list`,method: 'get'})}


//会员信息  详情
export const userDetileId = (userId) => {return http.request({url: `/DetailsFunction/getUserInfo/${userId}?userId=`+userId,method: 'get'})}
//用户监测列表
export const userMonitorList = (id) => {return http.request({url: `/DetailsFunction/userMonitorList/${id}`,method: 'get'})}
//用户监测  详情
export const userMonitorDetile = (id,userId) => {return http.request({url: `/DetailsFunction/detile?id=${id}&userId=${userId}`,method: 'get'})}
//用户监测  饮食记录
export const dietRecordList = (data) => {return http.request({url: `/DetailsFunction/dietRecordList`,method: 'get',data})}
//用户监测  饮食详情
export const dietRecordId = (id) => {return http.request({url: `/DetailsFunction/infoDietRecord/${id}`,method: 'get',id})}
//用户基本信息  列表
export const userInfoListDetail = (data) => {return http.request({url: `/DetailsFunction/userInfoList`,method: 'get',data})}
//用户就医记录  列表
export const userMedicalRecorList = (data) => {return http.request({url: `/DetailsFunction/medicalRecorList`,method: 'get',data})}
//用户就医记录  详情
export const userDoctorId = (id,userId) => {return http.request({url: `/DetailsFunction/findByRecords/${id}?userId=${userId}`,method: 'get'})}
//用户用药记录  列表
export const userDrugsList = (data) => {return http.request({url: `/DetailsFunction/drugsList`,method: 'get',data})}
//用户用药记录  详情
export const memberFindByDrugs = (id) => {return http.request({url: `/DetailsFunction/findByDrugs/${id}`,method: 'get'})}

//用户基本信息  详情
export const memberUserInfoDetail = (id) => {return http.request({url: `/DetailsFunction/details?id=`+id,method: 'get'})}
//查看用户问卷  列表
export const userQuestionnaireList = (data) => {return http.request({url: `/DetailsFunction/userQuestionnaireList`,method: 'get',data})}
//查看用户生活方式问卷  详情
export const DetailsFunctionId = (id) => {return http.request({url: `/DetailsFunction/findBy/${id}?type=1`,method: 'get'})}
//查看用户随访记录  列表
export const userFollowUpRecordsList = (data) => {return http.request({url: `/DetailsFunction/userFollowUpRecordsList`,method: 'get',data})}
//查看用户随访记录  详情
export const detaileFollowUpRecords = (id) => {return http.request({url: `/DetailsFunction/detaileFollowUpRecords/${id}`,method: 'get'})}
//查看用户转诊记录  列表
export const userReferralList = (data) => {return http.request({url: `/DetailsFunction/userReferralList`,method: 'get',data})}
//查看用户转诊记录  详情
export const userInfoReferralRecords = (id) => {return http.request({url: `/DetailsFunction/infoReferralRecords/${id}`,method: 'get'})}
//查看用户干预记录  列表
export const userPlanRecordList = (data) => {return http.request({url: `/DetailsFunction/userPlanList`,method: 'get',data})}
//查看用户干预计划  列表
export const userPlanList = (data) => {return http.request({url: `/DetailsFunction/planList`,method: 'get',data})}
//用户干预记录  详情
export const userinfoPlan = (id) => {return http.request({url: `/DetailsFunction/planDetails/${id}`,method: 'get'})}
//干预方案  列表
export const userInterveneSchemeList = (data) => {return http.request({url: `/DetailsFunction/userInterveneSchemeList`,method: 'get',data})}
//用户干预方案  详情
export const infoInterveneSchemeDetail = (id) => {return http.request({url: `/DetailsFunction/infoInterveneScheme/${id}`,method: 'get'})}
//用户健康风险评估汇总  列表
export const userRisksList = (data) => {return http.request({url: `/DetailsFunction/userRisksList`,method: 'get',data})}
//用户健康风险评估汇总  详情
export const userRisksId = (id,type,userId) => {return http.request({url: `/DetailsFunction/info/${id}?type=${type}&userId=${userId}`,method: 'get'})}
//用户评估报告列表
export const userMedicalList = (data) => {return http.request({url: `/DetailsFunction/userMedicalList`,method: 'get',data})}
//用户体检报告详情
export const userRisksFindByReport = (number) => {return http.request({url: `/DetailsFunction/findByReport/${number}`,method: 'get'})}
//用户体检报告详情  图片
export const userRisksfindId = (id) => {return http.request({url: `/DetailsFunction/findById/${id}`,method: 'get'})}
//望闻切详情
export const chineseMedicineDetailsId = (id) => {return http.request({url: `/DetailsFunction/chineseMedicineDetails?id=`+id,method: 'get'})}
//获取wx图片
export const getImage = (serverId) => {return http.request({url: `/wx/getImage?serverId=`+serverId,method: 'post'})}
//体检报告新增
export const HealthExaminationReportSave = (data) => {return http.request({url: `/HealthExaminationReport/save`,method: 'post',data})}
//体检报告列表
export const HealthExaminationReportList = (data) => {return http.request({url: `/HealthExaminationReport/list`,method: 'get',data})}
//体检报告详情
export const HealthExaminationReportDetails = (id) => {return http.request({url: `/HealthExaminationReport/details?id=${id}`,method: 'get'})}
//体检报告编辑
export const HealthExaminationReportUpdate = (data) => {return http.request({url: `/HealthExaminationReport/update`,method: 'post',data})}
//体检报告删除
export const HealthExaminationReportDelete = (id) => {return http.request({url: `/HealthExaminationReport/delete/${id}`,method: 'post'})}
// 加载会员最新健康现状评估
export const appHealthAssessSummaryInfo = (userId) => {return http.request({url: `/appHealthAssessSummary/${userId}/info`,method: 'get'})}
// 生成健康现状汇总报告
export const appHealthAssessSummaryCreat = (userId,data) => {return http.request({url: `/appHealthAssessSummary/${userId}/report`,method: 'post',data})}
// 健康现状评估汇总列表
export const appHealthAssessSummaryList = (data) => {return http.request({url: `/appHealthAssessSummary/`,method: 'get',data})}
// 健康现状汇总详情
export const appHealthAssessSummaryDetail = (id) => {return http.request({url: `/appHealthAssessSummary/${id}`,method: 'get'})}
// 删除现状健康汇总
export const appHealthAssessSummaryDelete = (id) => {return http.request({url: `/appHealthAssessSummary/${id}`,method: 'post'})}
// 计算转化分
export const AppMentalHealthAssessmentRefresh = (data) => {return http.request({url: `/AppMentalHealthAssessment/refresh`,method: 'post',data})}
// 新增健康现状评估问卷
export const AppMentalHealthAssessmentAdd = (data) => {return http.request({url: `/AppMentalHealthAssessment/add`,method: 'post',data})}
// 健康现状评估详情
export const AppMentalHealthAssessmentDetails = (id) => {return http.request({url: `/AppMentalHealthAssessment/details/${id}`,method: 'get'})}
// 编辑健康现状评估问卷
export const AppMentalHealthAssessmentUpdate = (data) => {return http.request({url: `/AppMentalHealthAssessment/update`,method: 'post',data})}
// 新增未来疾病风险评估
export const appSicknessDangeAdd = (data) => {return http.request({url: `/appSicknessDange/add`,method: 'post',data})}
// 未来疾病风险评估列表
export const appSicknessDangeList = (data) => {return http.request({url: `/appSicknessDange/`,method: 'get',data})}
// 删除健康现状评估问卷
export const appSicknessDangeDelete = (id) => {return http.request({url: `/appSicknessDange/${id}`,method: 'post'})}
// 未来疾病风险评估详情
export const appSicknessDangeDetail = (id) => {return http.request({url: `/appSicknessDange/${id}`,method: 'get'})}
// 未来疾病风险评估修改
export const appSicknessDangeUpdate = (data) => {return http.request({url: `/appSicknessDange/update`,method: 'post',data})}
// 新增糖尿病和代谢综合征阳性检项疾病风险评估
export const appDiseaseDangeAdd = (data) => {return http.request({url: `/appDiseaseDange/`,method: 'post',data})}
// 糖尿病和代谢综合征阳性检项疾病风险评估列表
export const appDiseaseDangeList = (data) => {return http.request({url: `/appDiseaseDange/`,method: 'get',data})}
// 糖尿病和代谢综合征阳性检项疾病风险评估详情
export const appDiseaseDangeDetail = (id) => {return http.request({url: `/appDiseaseDange/${id}`,method: 'get'})}
// 修改糖尿病和代谢综合征阳性检项疾病风险评估
export const appDiseaseDangeUpdate = (data) => {return http.request({url: `/appDiseaseDange/edit`,method: 'post',data})}
// 删除糖尿病和代谢综合征阳性检项疾病风险评估
export const appDiseaseDangeDelete = (id) => {return http.request({url: `/appDiseaseDange/${id}`,method: 'post'})}
// 生成糖尿病疾病风险评估
export const appDiseaseDangeReport = (data) => {return http.request({url: `/appDiseaseDange/tnb/report`,method: 'post',data})}
// 生成代谢综合性病风险评估
export const appDiseaseDangedxzhReport = (data) => {return http.request({url: `/appDiseaseDange/dxzh/report`,method: 'post',data})}



//疾病汇总上传汇总报告pdf
export const appAssessSummaryUpload = (id,formData) => {
	return new Promise((resolve, reject) => {
		let config = {
			headers: {'Content-Type': 'multipart/form-data','Access-Token':localStorage.token}
		}
		axios.post(http.config.baseUrl + `/appAssessSummary/${id}/upload`, formData, config)
		.then(res => {
		  resolve(res);
		})
	})
}

//未来疾病风险生成pdf评估pdf
export const appSicknessDangeUpdateUploadWord = (id,formData) => {
	return new Promise((resolve, reject) => {
		let config = {
			headers: {'Content-Type': 'multipart/form-data','Access-Token':localStorage.token}
		}
		axios.post(http.config.baseUrl + `/appSicknessDange/uploadWord/${id}`, formData, config)
		.then(res => {
		  resolve(res);
		})
	})
}


//上传健康现状汇总报告pdf
export const appHealthAssessSummaryUpload = (id,formData) => {
	return new Promise((resolve, reject) => {
		let config = {
			headers: {'Content-Type': 'multipart/form-data','Access-Token':localStorage.token}
		}
		axios.post(http.config.baseUrl + `/appHealthAssessSummary/${id}/upload`, formData, config)
		.then(res => {
		  resolve(res);
		})
	})
}


//生成体检报告
export const HealthExaminationReportUploadWord = (formData,id) => {
	return new Promise((resolve, reject) => {
		uni.uploadFile({
			url: http.config.baseUrl + `/HealthExaminationReport/uploadWord/${id}`,
			formData,
			header: {
				'Access-Token':localStorage.token,
			},
			success: function(res) {
				resolve(JSON.parse(res.data));
			},
			fail: function(res) {
				resolve(JSON.parse(res.data));
			},
		})
	});
}

//测试
export const testPdf = (formData) => {
	return new Promise((resolve, reject) => {
		uni.uploadFile({
			url: http.config.baseUrl + `/test/uploadWord`,
			formData,
			header: {
				'Access-Token':localStorage.token,
			},
			success: function(res) {
				resolve(JSON.parse(res.data));
			},
			fail: function(res) {
				resolve(JSON.parse(res.data));
			},
		})
	});
}


//上传健康现状报告pdf
export const uploadPdf = (formData) => {
	return new Promise((resolve, reject) => {
		uni.uploadFile({
			url: http.config.baseUrl + '/appchinesemedicineexamination/uploadPdf',
			formData,
			header: {
				'Access-Token':localStorage.token,
			},
			success: function(res) {
				resolve(JSON.parse(res.data));
			},
			fail: function(res) {
				resolve(JSON.parse(res.data));
			},
		})
	});
}

export const findByTopicsType = (data) => {return http.request({url: `/healthTopics/findByTopicsType?${data}`,method: 'get'})} //根据题库类型查询题目
export const healthAssessmentAdd = (data) => {return http.request({url: `/AppMentalHealthAssessment/add`,method: 'post',data})}  //新增心理健康问卷
export const healthAssessmentList = (data) => {return http.request({url: `/AppMentalHealthAssessment/list`,method: 'get',data})}  //心理健康问卷列表
export const healthAssessmentDetails = (id) => {return http.request({url: `/AppMentalHealthAssessment/details/${id}`,method: 'get'})}  //心理健康问卷详情
export const healthAssessmentUpdate = (data) => {return http.request({url: `/AppMentalHealthAssessment/update`,method: 'post',data})}  //心理健康问卷修改
export const healthAssessmentDelete = (id) => {return http.request({url: `/AppMentalHealthAssessment/delete/${id}`,method: 'post'})}  //删除心理健康问卷
export const healthAssessmentuploadWord = (formData,id) => {return http.request({url: `/AppMentalHealthAssessment/uploadWord/${id}`,method: 'post',type:'form-data',formData})}  //生成pdf评估
//会员评估申请列表
export const AppMembershipEvaluationList = (data) => {return http.request({url: `/AppMembershipEvaluation/list`,method: 'get',data})} 
export const appAssessSummaryInfo = (id) => {return http.request({url: `/appAssessSummary/${id}`,method: 'get'})}  //汇总详情
export const getAppAssessSummaryInfo = (userId,type) => {return http.request({url: `/appAssessSummary/${userId}/${type}/info`,method: 'get'})}  //加载会员最新评估
export const appAssessSummaryfxhzReport = (userId,data) => {return http.request({url: `/appAssessSummary/${userId}/fxhz/report`,method: 'post',data})}  //生成风险汇总报告
// 生成健康现状汇总报告
export const appAssessSummaryxzhzReport = (userId,data) => {return http.request({url: `/appAssessSummary/${userId}/xzhz/report`,method: 'post',data})}
export const getAppAssessSummaryList = (data) => {return http.request({url: `/appAssessSummary/`,method: 'get',data})}  //评估汇总列表
export const AppAssessSummaryDel = (id) => {return http.request({url: `/appAssessSummary/${id}`,method: 'post'})}  //删除汇总

// 生成评估汇总报告
export const summaryAssessmentControllerAdd = (userId,data) => {return http.request({url: `/summaryAssessmentController/?userId=${userId}`,method: 'post',data})}
// 查询体检指标近年来的数据
export const summaryAssessmentControllerReportList = (userId) => {return http.request({url: `/summaryAssessmentController/reportList?userId=${userId}`,method: 'get'})}
// 评估汇总列表
export const summaryAssessmentControllerList = (data) => {return http.request({url: `/summaryAssessmentController/`,method: 'get',data})}





function toLogin (){uni.redirectTo({url:'/pages/login/index'});}
export default {
    login,
	logout,
	attentionList,
	addUser,
	selectMembershipList,
	BdMember,
	updatePassword,
	findByHealthId,
	addressList,
	multipleFiles,
	uploadImg ,
	updateHealth,
	toBbtainTCM,
	AppConstitutionQuestionnaireUpdate,
	newScore,
	appchinesemedicineexaminationSave,
	appchinesemedicineexaminationUpdate,
	appchinesemedicineexaminationList,
	appchinesemedicineexaminationInfo,
	tcmList,
	memberIdList,
	delTcmList,
	userMember,
	delUrl,
	interveneSchemeList,
	addPersonnel,
	Memberrecord,
	findByUser,
	userInfoAdd,
	verifyMobile,
	findByUserId,
	cancelUser,
	userInfolist,
	UserInfodelete,
	UserInfofindById,
	InterveneSchemeSave,
	InterveneSchemeInfo,
	InterveneSchemeupdate,
	InterveneSchemedelete,
	userinforUpdate,
	speciaList,
	bdExpert,
	InterventionPlanSave,
	InterventionPlanList,
	InterventionPlanPlanList,
	InterventionPlanDetails,
	InterventionPlanUpdate,
	InterventiondeleteByPlan,
	Interventiondelete,
	InterventionrunPlan,
	IMgetUserToken,
	createGroup,
	groupMembers,
	getMailList,
	inviteUser,
	userQuit,
	dissolution,
	newScore,
	AppConstitutionQuestionnaireScoreSure,
	appchinesemedicineexaminationfindById,
	findByStatusTcm,
	findByStatusUserInfo,
	findByStatusFindByStatus,
	DataDictfindByType,
	getQuestionnaireStencil,
	Questionnairefind,
	uploadQuestionnaire,
	Questionnairelist,
	updateAppQuestionnaire,
	QuestionnaireDel,
	getReportTemplateStencil,
	healthMedicalsave,
	Medicalinsert,
	MedicalList,
	MedicalfindbyId,
	Medicalupdate,
	Medicaldel,
	reportAddReport,
	healthAddReport,
	findByMedical,
	reportupdate,
	getReportAbnormalPage,
	getReportTemplateStencilPage,
	HealthRisksSave,
	HealthRiskslist,
	HealthRisksdel,
	HealthRisksInfo,
	HealthRisksUpdata,
	reportdel,
	findByUserInfo,
	findByConstitutionId,
	Assessreport,
	findByUserInfo,
	Assesslist,
	AssessfindById,
	AssesscreateReport,
	addQuestionnaireByUser,
	uploadUserAssessReport,
	uploadHealthAddUserReport,
	AppFollowUpRecordsSave,
	AppFollowUpRecordsUpdate,
	AppFollowUpRecordsList,
	AppFollowUpRecordsDetaile,
	AppFollowUpRecordsDelete,
	messageNoticeSave,
	messageNoticelist,
	messageNoticeInfo,
	messageNoticeUpdate,
	messageNoticeDelete,
	AppHealthReferralRecordsSave,
	AppHealthReferralRecordsList,
	AppHealthReferralRecordsInfo,
	AppHealthReferralRecordsUpdate,
	AppHealthReferralRecordsDelete,
	Articlelist,
	ArticleSave,
	ArticleInfo,
	ArticleDelete,
	ArticleUpdate,
	userDetileId,
	userMonitorList,
	userMonitorDetile,
	dietRecordList,
	dietRecordId,
	userInfoListDetail,
	memberUserInfoDetail,
	userFollowUpRecordsList,
	detaileFollowUpRecords,
	userReferralList,
	userInfoReferralRecords,
	userPlanList,
	userPlanRecordList,
	userinfoPlan,
	userInterveneSchemeList,
	infoInterveneSchemeDetail,
	userRisksList,
	userRisksId,
	userMedicalList,
	userRisksFindByReport,
	userQuestionnaireList,
	userRisksfindId,
	DetailsFunctionId,
	chineseMedicineDetailsId,
	ArticleTypelist,
	uploadPdf,
	delReportNo,
	userMedicalRecorList,
	userDrugsList,
	memberFindByDrugs,
	userDoctorId,
	getImage,
	HealthExaminationReportSave,
	HealthExaminationReportList,
	HealthExaminationReportDetails,
	HealthExaminationReportUpdate,
	HealthExaminationReportDelete,
	HealthExaminationReportUploadWord,
	testPdf,
	findByTopicsType,
	healthAssessmentAdd,
	healthAssessmentList,
	healthAssessmentDetails,
	healthAssessmentUpdate,
	healthAssessmentDelete,
	healthAssessmentuploadWord,
	AppMembershipEvaluationList,
	appHealthAssessSummaryInfo,
	appHealthAssessSummaryCreat,
	appHealthAssessSummaryUpload,
	appHealthAssessSummaryList,
	appHealthAssessSummaryDetail,
	appHealthAssessSummaryDelete,
	AppMentalHealthAssessmentRefresh,
	AppMentalHealthAssessmentAdd,
	AppMentalHealthAssessmentDetails,
	AppMentalHealthAssessmentUpdate,
	appSicknessDangeAdd,
	appSicknessDangeList,
	appSicknessDangeDelete,
	appSicknessDangeDetail,
	appSicknessDangeUpdate,
	appSicknessDangeUpdateUploadWord,
	appDiseaseDangeAdd,
	appDiseaseDangeList,
	appDiseaseDangeDetail,
	appDiseaseDangeUpdate,
	appDiseaseDangeDelete,
	appDiseaseDangeReport,
	appDiseaseDangedxzhReport,
	appAssessSummaryInfo,
	getAppAssessSummaryInfo,
	appAssessSummaryfxhzReport,
	appAssessSummaryxzhzReport,
	appAssessSummaryUpload,
	getAppAssessSummaryList,
	AppAssessSummaryDel,
	summaryAssessmentControllerAdd,
	summaryAssessmentControllerReportList,
	summaryAssessmentControllerList
}